class Solution{
    void get_all_subsets(vector<vector<int> > &vv, vector<int> v,vector<int> left, int k) {
        if(!left.size()) {
            vector<int> t;
            vv.push_back(t);
            return;
        }
        if(left.size()-1 == k) {
            vv.push_back(vector<int>(v));
            v.push_back(left[k]);
            vv.push_back(vector<int>(v));
            return;
        }
        get_all_subsets(vv, vector<int>(v), left, k+1);
        vector<int> t(v);
        t.push_back(left[k]);
        get_all_subsets(vv, t, left, k+1);
    }
    vector<vector<int> > subsets(vector<int> &S) {
        vector<vector<int> > vv;
        vector<int> v;
        sort(S.begin(), S.end());
        get_all_subsets(vv, v, S, 0);
        return vv;
    }

};
